package com.ztgf.commodity.models.service;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.ztgf.commodity.models.bo.CommodityAdminCategoryAddBO;
import com.ztgf.commodity.models.bo.CommodityCategoryBO;
import com.ztgf.commodity.models.bo.CommodityCategorySaveBO;
import com.ztgf.commodity.models.bo.CommodityCategoryUpdateBO;
import com.ztgf.commodity.models.dto.CommodityCategoryDTO;
import com.ztgf.commodity.models.vo.*;
import com.ztgf.common.constant.Result;

import java.math.BigDecimal;
import java.util.List;

/**
 * author: chenyu.wang
 * date: 2020-05-25 11:19
 * Description:
 */
public interface ICommodityCategoryService extends IService<CommodityCategoryDTO> {

    /**
     * description: 类目树形结构
     * param: []
     * author: chenyu.wang
     * date: 2020-05-28
     * return: java.util.List<com.ztgf.commodity.models.vo.CommodityCategoryTreeVO>
     */
    List<CommodityCategoryTreeVO> queryCategoryTree();


    /**
     * description: 类目树形结构
     * param: []
     * author: chenyu.wang
     * date: 2020-05-28
     * return: java.util.List<com.ztgf.commodity.models.vo.CommodityCategoryTreeVO>
     */
    List<CommodityCategoryTreeVO> queryCategoryTree(Long shopId);

    /*
     * @description:后台管理系统类目管理
     * @author: chenyu.wang
     * @date: 2020-09-07
     */
    List<CommodityCategoryTreeVO> queryAdminCategoryTree();

    /**
     * description: 后台管理系统添加类目
     * param: [bo]
     * author: chenyu.wang
     * date: 2020-07-07
     * return: com.ztgf.common.constant.Result<java.util.List<java.lang.String>>
     */
    Result<List<String>> addAdminCategory(CommodityAdminCategoryAddBO bo);

    /**
     * description: 后台管理系统查看类目详情
     * param: [id]
     * author: chenyu.wang
     * date: 2020-07-08
     * return: com.ztgf.commodity.models.vo.CommodityAdminCategoryDetailsVO
     */
    CommodityAdminCategoryDetailsVO getAdminDetailsById(Long id);

    /**
     * description: 后台管理系统佣金管理列表
     * param: [bo]
     * author: chenyu.wang
     * date: 2020-07-08
     * return: com.baomidou.mybatisplus.plugins.Page<com.ztgf.commodity.models.vo.CommodityCategoryBrokerageVO>
     */
    Page<CommodityCategoryBrokerageVO> queryAdminBrokerageList(CommodityCategoryBO bo);

    /**
     * description: 后台管理系统佣金管理批量设置技术服务费率
     * param: [ids, num]
     * author: chenyu.wang
     * date: 2020-07-08
     * return: boolean
     */
    boolean updateTechnicalServiceRatesInBatches(String ids, BigDecimal num,String date);

    /**
     * description: 后台管理系统佣金管理批量设置生效时间
     * param: [ids, date]
     * author: chenyu.wang
     * date: 2020-07-08
     * return: boolean
     */
    boolean updateEffectiveTime(String ids, String date);

    /**
     * description: 根据最终级类目查询类目父级
     * param: [id, list]
     * author: chenyu.wang
     * date: 2020-07-23
     * return: java.util.List<com.ztgf.commodity.models.vo.CommodityCategoryTreeVO>
     */
    List<CommodityCategoryTreeVO> getByChildId(Long id, List<CommodityCategoryTreeVO> list);

    /**
     * description: 查询店铺所属类目
     * param: [shopId]
     * author: chenyu.wang
     * date: 2020-07-23
     * return: java.util.List<com.ztgf.commodity.models.vo.CommodityCategoryTreeVO>
     */
    List<CommodityCategoryTreeVO> queryShopCategory(Long shopId);

    /**
     * description: 查询店铺所属类目
     * param: [shopId]
     * author: chenyu.wang
     * date: 2020-07-23
     * return: java.util.List<com.ztgf.commodity.models.vo.CommodityCategoryTreeVO>
     */
    List<CommodityShopCategoryVO> queryShopCategory(Long shopId,String cid);


    /**
     * description: 查询店铺可售区域
     * param: [shopId]
     * author: chenyu.wang
     * date: 2020-07-23
     * return: java.util.List<com.ztgf.commodity.models.vo.CommodityShopAvailableAreaVO>
     */
    List<CommodityShopAvailableAreaVO> queryShopAvailableArea(Long shopId);

    /**
     * description: 删除类目
     * param: [id]
     * author: chenyu.wang
     * date: 2020-07-23
     * return: com.ztgf.common.constant.Result<java.util.List<java.lang.String>>
     */
    Result<List<String>> removeById(Long id);

    /**
     * description: 修改类目
     * param: [bo]
     * author: chenyu.wang
     * date: 2020-07-29
     * return: com.ztgf.common.constant.Result<java.util.List<java.lang.String>>
     */
    Result<List<String>> updateCategory(CommodityCategorySaveBO bo);

    /**
     * description: 根据顶级类目id获取筛选属性，类目id可以为空
     * param: [categoryId]
     * author: chenyu.wang
     * date: 2020-08-03
     * return: com.ztgf.commodity.models.vo.CommodityFilterAttributesVO
     */
    List<CommodityFilterAttributesNewVO> getFilterAttributes(Long categoryId, String filterName);

    /**
     * description: 查询店铺所属类目,根据品牌id
     * param: [brandId]
     * author: chenyu.wang
     * date: 2020-08-03
     * return: java.util.List<com.ztgf.commodity.models.vo.CommodityCategoryTreeVO>
     */
    List<CommodityCategoryTreeVO> queryShopCategoryByBrandId(Long brandId, Long shopId);

    /**
     * description: 根据一级类目ids获取树形结构
     * param: [ids]
     * author: chenyu.wang
     * date: 2020-08-04
     * return: java.util.List<com.ztgf.commodity.models.vo.CommodityCategoryTreeVO>
     */
    List<CommodityCategoryTreeVO> getTreeByIds(Long id);

    Integer getCheckCategory(Long id);

    String creatTreeById(Long categoryId, String names);

    CategoryAdminDetailsNewVO queryCategoryDetails(Long id);

    boolean updateIsPush(Long id, Integer state);

    List<CategoryBrandAttributesVO> getSalesAttributes(Long categoryId, Long brandId);

    List<CommodityInquiryBrandVO> queryInquiryBrandByCategoryId(Long categoryId);

    Result<List<String>> addNewCategory(CommodityAdminCategoryAddBO bo);

    Result<List<String>> updateNewCategory(CommodityCategorySaveBO bo);

    boolean updateDividendScaleInBatches(CommodityCategoryUpdateBO bo); //后台管理系统佣金管理批量设置(包括比例和时间)

    /**
     * @Description: 从redis中获取类目树
     * @Author: WangChenYu
     * @Param: []
     * @Date: 2020-10-10 16:09
     */
    List<CommodityCategoryTreeVO> queryNewCategoryTree(Long shopId);

    /**
     * @Description: 从redis中获取类目树
     * @Author: WangChenYu
     * @Param: []
     * @Date: 2020-10-10 16:09
     */
    List<CommodityCategoryTreeVO> queryNewCategoryTree();

    /**
     * @Description: 根据类目id获取佣金比例
     * @Author: chenyu.wang
     * @Params: [id]
     * @Date: 2020.11.06 14:27
     */
    String getCommissionRate(Long id);

//    /**
//     * @Description: 根据类目id获取品牌信息
//     * @Author: chenyu.wang
//     * @Params: [categoryId]
//     * @Date: 2020.11.10 14:45
//     */
//    List<BrandInfoDTO> queryBrandByCategoryId(Long categoryId);

//    /**
//     * @Description: 后台类目管理导入属性返回导入的信息
//     * @Author: chenyu.wang
//     * @Params: [input, id]
//     * @Date: 2020.11.24 10:56
//     */
//    CategoryAdminDetailsNewVO importAttributes(byte[] input, Long id);

    /**
     * @Description: 查询所有一级类目
     * @Author: chenyu.wang
     * @Params: []
     * @Date: 2020.12.02 14:14
     */
    List<CommodityCategoryDTO> queryAllFirstLevelCategories();

    /**
     * @return : java.util.List<com.ztgf.commodity.models.vo.CategoryExportVO>
     * @Author :chenyu.wang
     * @Description : 获取全部类目导出的数据
     * @Date : 10:16 2021.01.15
     * @Param : []
     **/
    List<CategoryExportVO> getCategoryExportDate();

//    CategoryBrandVO checkBrand(String brandName);


    List<CommodityCategoryDTO> getAllFinalCategory(List<CommodityCategoryDTO> list, List<CommodityCategoryDTO> list2);

    /**
     * @Description: 导入检查标签属性是否存在
     * @Author: chenyu.wang
     * @Params: [name]
     * @Date: 2020.12.30 11:52
     */
     CategoryBrandAttributesVO checkLabel(String name);

    /**
     * @Description: 导入时判断参数是否存在品牌，有则返回，没有则新建
     * @Author: chenyu.wang
     * @Params: [list]
     * @Date: 2020.11.30 15:58
     */
    List<CategoryBrandAttributesVO> checkParameterAttributes(List<CategoryBrandAttributesVO> list, CategoryAdminDetailsNewVO category, CategoryBrandVO brand);

    /**
     * @Description: 导入时判断检查规格属性
     * @Author: chenyu.wang
     * @Params: [list, category, brand]
     * @Date: 2020.12.01 15:21
     */
    List<CategoryBrandAttributesVO> checkSpecificationAttributes(List<CategoryBrandAttributesVO> list, CategoryAdminDetailsNewVO category, CategoryBrandVO brand);

    /**
     * @Description: 导入属性时判断单位是否存在，不存在就创建新的
     * @Author: chenyu.wang
     * @Params: [unitName]
     * @Date: 2020.11.24 17:23
     */
    CategoryBrandAttributesVO checkUnit(String unitName);


    /**
     * @Description: 10分钟定时任务修改佣金比例
     * @Author: liyang
     * @param dtos
     * @return
     */
    boolean updateDividendScaleByScheduled(List<CommodityCategoryDTO> dtos);

}
